<?php

namespace App\Http\Requests\OpenWechat;

use App\Http\Requests\ApiRequest;

/**
 * @property string appid
 * @property string|null code
 * @property string|null state
 */
class OAuthCallBackRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            /**
             * appid 在文档上并没说一定有
             *
             * @link https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842
             */
            'appid'     => 'nullable|string',
            'code'      => 'required|string',
            'state'     => 'required|string',
        ];
    }

}
